#include<iostream>
#include<cmath>
using namespace std;
#define eps 1e-8

struct point
{
    double x,y;
    explicit point(double a=0.f,double b=0.f)
    {
        x = a;
        y = b;
    }
};

inline bool is_zero(double x)
{
    return fabs(x) < eps;
}

// cross product of (a,b) * (c,d)
double cross_product(const point& p1,const point& p2,const point& p)
{
    double a = p1.x - p.x;
    double b = p1.y - p.y;
    double c = p2.x - p.x;
    double d = p2.y - p.y;
    return a*d-c*b;
}

/* @return:  0 --> p is not on the line of <l1,l2>;
			 1 --> p is on the line.
*/
int is_dot_on_line(const point& p,const point& l1,const point& l2)
{
    return is_zero(cross_product(p,l1,l2))
           &&(l1.x-p.x)*(l2.x-p.x)<eps
           &&(l1.y-p.y)*(l2.y-p.y)<eps;
}

/* @description:  whether p1 and p2 are on the same side of the line <l1,l2>
*/
int at_same_side(const point& p1,const point& p2,
                 const point& l1,const point& l2)
{
    return cross_product(l1,p1,l2)*cross_product(l1,p2,l2) >= 0;
}

int is_line_intersect(const point& u1,const point& u2,
                      const point& v1, const point& v2)
{

    if(is_dot_on_line(u1,v1,v2)||
            is_dot_on_line(u2,v1,v2)||
            is_dot_on_line(v1,u1,u2)||
            is_dot_on_line(v2,u1,u2))
        return 1;

    return !at_same_side(u1,u2,v1,v2)
           &&!at_same_side(v1,v2,u1,u2);
}

int main(void)
{
    while(true)
    {
        cout<<"input 8 double;"<<endl;
        double x1,x2,x3,x4,x5,x6,x7,x8;
        cin>>x1>>x2>>x3>>x4>>x5>>x6>>x7>>x8;
        point u1(x1,x2);
        point u2(x3,x4);
        point v1(x5,x6);
        point v2(x7,x8);

        cout<< "two lines intersected?  0:no  1:yes"<<endl;
        cout<< is_line_intersect(u1,u2,v1,v2)<<endl;
    }

    return 0;
}

